package cloudUser.controller;

import cloudEntity.dto.user.SmartUserRegisterDTO;
import cloudEntity.utils.ResultUtils;
import cloudUser.service.SmartUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: Smart School
 * @ClassName UserController
 * @description: 用户 控制器
 * @author: 陈智博
 * @create: 2025-05-23 09:02
 * @Version 1.0
 **/
@RestController
@RequestMapping("/user")
@Tag(name = "用户控制器")
public class UserController {

    @Autowired
    private SmartUserService smartUserService;

    @Operation(summary = "用户注册")
    @Parameter(name = "smartUserRegisterDTO",description = "用户注册DTO",required = true)
    @RequestMapping(method = RequestMethod.POST,value = "/register")
    public ResultUtils UserRegister(@RequestBody SmartUserRegisterDTO smartUserRegisterDTO)
    {
        Integer i = smartUserService.RegisterUser(smartUserRegisterDTO);
        if(i>0)
        {
            return ResultUtils.success("用户注册成功!");
        }
        return ResultUtils.failed("用户注册失败!");
    }

}
